﻿using Admin.Model.Tool;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace Admin.IRepository
{
    public interface IBaseRepository<TEntity> : IRepository where TEntity : class
    {
        Task<int> Insert(object param, string[] fields, IDbTransaction transaction = null);
        Task<int> Insert(TEntity model, IDbTransaction transaction = null);
        Task<int> Insert(List<TEntity> list);
        Task<int> Insert(List<TEntity> list, string[] fields);
        Task<int> Edit(object param, string[] fields, IDbTransaction transaction = null);
        Task<int> Edit(object param, string[] fields, string sqlWhere, IDbTransaction transaction = null);
        Task<int> Delete(int code, IDbTransaction transaction = null);
        Task<int> Delete(object param, string sqlWhere, IDbTransaction transaction = null);
        Task<int> Delete(string ids);
        Task<TEntity> Get(int code, CacheModel cacheEntity = null);
        Task<TEntity> Get(object param, string sqlWhere, string showFields = "*", CacheModel cacheEntity = null);
        Task<IEnumerable<TEntity>> GetList(CacheModel cacheEntity = null);
        Task<IEnumerable<TEntity>> GetTopList(int TopNumber, object param, string sqlWhere, string orderBy, string showFields = "*", CacheModel cacheEntity = null);
        Task<IEnumerable<TEntity>> GetList(object param, string sqlWhere, string orderBy, string showFields = "*", CacheModel cacheEntity = null);
        Task<bool> IsExist(object param, string sqlWhere);
        Task<int> GetCount(object param, string sqlWhere);
        Task<IEnumerable<TEntity>> GetPage(int page, int pageSize, object param, string sqlWhere, string orderBy, string showFields = "*", CacheModel cacheEntity = null);
    }
}
